﻿@inject CustomerSettings customerSettings

@if (!customerSettings.HideNewsletterBlock)
{
    <div class="newsletter">
        <h2 class="newsletter-title">
            @Loc["Newsletter.Title"]
        </h2>
        <div class="newsletter-desc">
            @Loc["Newsletter.Desc"]
        </div>
        <div class="input-group" role="group">
            <input id="newsletter-email" class="input-group-text form-control newsletter-email"
                   placeholder="@Loc["Newsletter.Email.Placeholder"]" aria-label="@Loc["Newsletter.Email.Placeholder"]"/>
            <label for="newsletter-email" class="sr-only">newsletter</label>
            <div class="input-group-append">
                <button class="btn btn-secondary newsletter-email-button" id="newsletter-subscribe-button" @@click="newsletterBox(@customerSettings.NewsletterBlockAllowToUnsubscribe.ToString().ToLower(), '@(Url.RouteUrl("SubscribeNewsletter"))')">
                    <b-icon icon="envelope"></b-icon>
                </button>
            </div>
        </div>
        @if (customerSettings.NewsletterBlockAllowToUnsubscribe)
        {
            <div class="custom-controls-stacked newsletter-subscribe-unsubscribe justify-content-center w-100 pt-1">
                <fieldset class="d-inline-flex justify-content-center w-100">
                    <div class="custom-control custom-radio mb-2">
                        <input value="newsletter_unsubscribe" id="newsletter_subscribe" name="newsletter_block" type="radio" class="custom-control-input" checked="checked">
                        <label class="custom-control-label text-white" for="newsletter_subscribe">@Loc["Newsletter.Options.Subscribe"]</label>
                    </div>
                    <div class="custom-control custom-radio ml-3 mb-2">
                        <input value="newsletter_unsubscribe" id="newsletter_unsubscribe" name="newsletter_block" type="radio" class="custom-control-input">
                        <label class="custom-control-label text-white" for="newsletter_unsubscribe">@Loc["Newsletter.Options.Unsubscribe"]</label>
                    </div>
                </fieldset>
            </div>
        }
        <div class="newsletter-validation text-white text-center w-100">
            <span id="subscribe-loading-progress" style="display: none;" class="please-wait">@Loc["Common.Wait..."]</span>

        </div>
        <div id="newsletter-result-block" style="display: none;" class="newsletter-result text-center text-white w-100">
            <div class="alert alert-info">
            </div>
        </div>
        <input type="hidden" id="newsletterbox" data-href="@(Url.RouteUrl("SubscribeNewsletter"))" data-allowtounsubscribe=@customerSettings.NewsletterBlockAllowToUnsubscribe/>
    </div>
}